package cn.kai.ums.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.List;

import lombok.Data;

/**
 * 
 * @TableName ums_grade
 */
@TableName(value ="ums_grade")
@Data
public class UmsGrade implements Serializable {
    /**
     * 成绩表自增id
     */
    @TableId(type=IdType.AUTO)
    private Integer gradeId;

    /**
     * 学生学号，由所在班级编号（8位）+数字（2位）组成
     */
    private String gradeStudentNo;

    /**
     * 课程编号
     */
    private String gradeCourseNo;

    /**
     * 是否为选修课
     */
    private Integer gradeSelect;

    /**
     * 最终成绩
     */
    private Double grade;

    @TableField(exist = false)
    private List<UmsPublicCourse> umsPublicCourseList;

    @TableField(exist = false)
    private List<UmsClassCourse> umsClassCourseList;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UmsGrade other = (UmsGrade) that;
        return (this.getGradeId() == null ? other.getGradeId() == null : this.getGradeId().equals(other.getGradeId()))
            && (this.getGradeStudentNo() == null ? other.getGradeStudentNo() == null : this.getGradeStudentNo().equals(other.getGradeStudentNo()))
            && (this.getGradeCourseNo() == null ? other.getGradeCourseNo() == null : this.getGradeCourseNo().equals(other.getGradeCourseNo()))
            && (this.getGradeSelect() == null ? other.getGradeSelect() == null : this.getGradeSelect().equals(other.getGradeSelect()))
            && (this.getGrade() == null ? other.getGrade() == null : this.getGrade().equals(other.getGrade()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getGradeId() == null) ? 0 : getGradeId().hashCode());
        result = prime * result + ((getGradeStudentNo() == null) ? 0 : getGradeStudentNo().hashCode());
        result = prime * result + ((getGradeCourseNo() == null) ? 0 : getGradeCourseNo().hashCode());
        result = prime * result + ((getGradeSelect() == null) ? 0 : getGradeSelect().hashCode());
        result = prime * result + ((getGrade() == null) ? 0 : getGrade().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", gradeId=").append(gradeId);
        sb.append(", gradeStudentNo=").append(gradeStudentNo);
        sb.append(", gradeCourseNo=").append(gradeCourseNo);
        sb.append(", gradeSelect=").append(gradeSelect);
        sb.append(", grade=").append(grade);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}